exports.CreateScreenMenuCategories=function(_args)
{
	var pathimage=Ti.App.Properties.getString('pathimage');
	var tableview = Ti.UI.createTableView({
		// borderColor: Ti.App.Properties.getString('borderColor'),
	    // borderRadius: Ti.App.Properties.getInt('borderRadius'),
	    // borderWidth:Ti.App.Properties.getInt('borderWidth'),
		width:_args.width,
		height:_args.height,
		backgroundColor: _args.backgroundColor,
		top:0,
		left:_args.left,
		separatorColor:'Transparent',
	})
	
	var LoadTablesDemo_Data = function() {
 		var json=require('db').selectScreenMenuCategories();
		return json;
    }
  	var CreateTableViewRow = function(e) {
		var item=e.data;
		var row = Ti.UI.createTableViewRow({
	            height:	Ti.App.Properties.getInt('Order_buttonnumber_height'),//Ti.App.Properties.getInt('button_height'),
				Id:item.Id,
				Name:item.Name
		})
		var bt=Titanium.UI.createButton({
			
		     borderColor: Ti.App.Properties.getString('borderColor'),
		     borderRadius: Ti.App.Properties.getInt('borderRadius'),
		     borderWidth:Ti.App.Properties.getInt('borderWidth'),
		     
			 color:'Black',
			 Id:item.Id,
			 Name:item.Name,
			 title:item.Name,
			 left:0,
			 width:tableview.width,
			 height:	row.height,
			 backgroundImage:pathimage+'bt_oranges.png',
			 backgroundSelectedImage:pathimage+'table.png',
			
	   	 	 
		}); 
		bt.addEventListener('click', function (e) {
			Ti.App.fireEvent('OrderWindow:ChangeScreenMenuCategories',{data:e.source.Id});
			
        })
		row.add(bt);
		return row;
	};
    var LoadTables = function() {
    	
 		var tableData=[];
 		var json=[];
 		
 		if (Ti.App.Properties.getInt('IsDemo')==1) 
 		{
 			json=LoadTablesDemo_Data();
 		}
 		else
 		{
 			//json=LoadListDataLocal(e);
 		}
 		
 		//Ti.API.info ('Chieu dai????'+json.length)
 		/*
 		if (json.length==0) {
 			require('settings').Alert_error(win,Globals.connect_pop);
 		}else
 		*/
 		require('settings').LoadingData2TableViewNoScrool(tableview,json,CreateTableViewRow);
	};
	
	LoadTables()
	
	return tableview;
}
